package com.atguigu.clients;

import com.atguigu.param.PageParam;
import com.atguigu.param.ProductHotsParam;
import com.atguigu.pojo.Category;
import com.atguigu.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("category-service")
public interface CategoryClient {

    @GetMapping("category/{categoryName}")
    public R detail(@PathVariable String categoryName);

    @PostMapping("category/names")
    public R names(@RequestBody @Validated ProductHotsParam productHotsParam);

    @GetMapping("category/list")
    public R list();

    @GetMapping("category/listCategory")
    public R listCategory(@RequestBody PageParam pageParam);

    @PostMapping("category/save")
    public R save(@RequestBody Category category);

    @PostMapping("category/remove")
    public R remove(@RequestBody Integer categoryId);

    @PostMapping("category/update")
    public R update(@RequestBody Category category);
}
